<!--
 * @Descripttion: 
 * @version: 
 * @Author: zhaoxiaodong
 * @Date: 2020-09-01 10:08:02
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2020-10-13 13:44:43
-->
<template>
    <div id="root" class="main-container">
        <!-- 登录视图 -->
        <sub-app v-if="hasToken"></sub-app>
        <router-view v-else></router-view>
    </div>
</template>

<script>
import subApp from "@/views/main/index.vue";
export default {
    name: "root",
    components: {
        subApp,
    },
    computed: {
        hasToken() {
            return !!this.$store.getters.userInfo.id;
        },
    },
};
</script>

<style lang="scss">
html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
}
.main-container {
    position: absolute;
    display: flex;
    flex-direction: row;
    left: 0;
    top: 0;
    display: block;
    width: 100%;
    height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
</style>
